package com.hfi.qinxiaobo151;

import org.junit.Test;

/**
 * @author ChangLiang
 * @date 2018/9/3
 */
public class Item1_6 {

    @Test
    public void test() {
        //向上转型
        Base base = new Sub();
        base.fun(100, 50);
        //不转型
        Sub sub = new Sub();
//        sub.fun(100, 50);
    }
}

class Base{
    void fun(int price,int... discounts){
        System.out.println("Base……fun");
    }
}

//子类，覆写父类方法
class Sub extends Base{
    @Override
    void fun(int price,int[] discounts){
        System.out.println("Sub……fun");
    }
}
